package com.lzx.adx.report.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.lzs.adx.commmon.service.impl.CrudServiceImpl;
import com.lzx.adx.report.dao.ConfigLinkerDao;
import com.lzx.adx.report.dto.ConfigLinkerDTO;
import com.lzx.adx.report.entity.ConfigLinkerEntity;
import com.lzx.adx.report.service.ConfigLinkerService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.Objects;

/**
 * 淘宝砍价链接配置表
 *
 * @author wangzhijun 825400558@qq.com
 * @since 1.0.0 2025-08-07
 */
@Service
public class ConfigLinkerServiceImpl extends CrudServiceImpl<ConfigLinkerDao, ConfigLinkerEntity, ConfigLinkerDTO> implements ConfigLinkerService {

    @Override
    public QueryWrapper<ConfigLinkerEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
        Long status = (Long)params.get("status");
        Long userId = (Long)params.get("userId");

        QueryWrapper<ConfigLinkerEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);
        wrapper.eq(Objects.nonNull(status), "status", status);
        wrapper.eq(Objects.nonNull(userId), "user_id", userId);

        return wrapper;
    }


}